<template>
	<view class="balance">
		<u-navbar title="余额" :title-size="35" :title-bold="true" :immersive="true" :background="background"
			:border-bottom="false"></u-navbar>
		<view class="item" :style="{backgroundImage: 'url('+image+')',backgroundSize: '100% 100%'}">
			<view class="account">
				账户余额（元）
			</view>
			<view class="money">
				<view class="money-p" style="font-size: 30rpx;display: inline;">￥</view>{{balance}}
			</view>
			<!-- <view class="topup" @click="recharge">
				<view class="topup-p">
					充值
				</view>
			</view> -->
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				image: 'https://gongxiangtaiqiu.axa2.com/taiqiu/balance.png',
				balance: '',
			}
		},
		onLoad() {
			this.blance()
			if(!uni.getStorageSync('shop_name')){
				uni.showToast({
					icon: 'none',
					title: '请在我的-选择店铺后再查看余额',
					duration:3000
					
				})
			}
			
			
		},
		onShow() {
			this.blance()
		},
		methods: {
			//余额
			blance() {
				this.$Api.getBlance({
					userId: uni.getStorageSync('userid'),
					shopId: uni.getStorageSync('shop_id'),
					// userId: 2679,
					// shopId: 61,
				}).then(res => {
					this.balance = res.data.data
					console.log(res.data.data)
				});
			},
			recharge() {
				uni.navigateTo({
					url: '/pagesB/rechargeAmount/rechargeAmount'
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background: #ffffff;
	}

	.balance {
		width: 100%;
		height: auto;
	}

	.item {
		width: 691rpx;
		height: 300rpx;
		margin: auto;
		margin-top: 200rpx;
		border-radius: 20px;

		// background-image:url('https://static.runoob.com/images/mix/gradient2.png');
		.account {
			width: 250rpx;
			height: 29rpx;
			font-size: 30rpx;
			font-family: PingFang SC;
			font-weight: bold;
			color: #FFFFFF;
			padding-top: 60rpx;
			margin-left: 60rpx;
		}

		.money {
			width: 231rpx;
			height: 48rpx;
			font-size: 30px;
			font-family: PingFang SC;
			font-weight: bold;
			color: #FFFFFF;
			margin-top: 50rpx;
			margin-left: 60rpx;
		}

		.topup {
			width: 148rpx;
			height: 56rpx;
			background: #222222;
			border-radius: 28rpx;
			display: flex;
			justify-content: center;
			align-items: center;
			margin-left: 500rpx;

			.topup-p {
				// width: 55rpx;
				// height: 28rpx;
				font-size: 28rpx;
				font-family: PingFang SC;
				font-weight: bold;
				color: #02FF83;


			}
		}
	}
</style>
